import QtQuick 2.0
import "./Custom"

ScreenBase{
    id: bg
    anchors.fill: parent
    source: "qrc:/images/bg3.png"

    property real currentIndex: 0
    signal selectMan(real v)

    Row{
        anchors.horizontalCenter: parent.horizontalCenter
        y: 50
        spacing: 20

        Rectangle{
            width: 130
            height: 184
            color: Qt.rgba(222/250,222/250,222/250,1)

            Image {
                id: name
                source: "qrc:/images/man1.png"
                Rectangle{
                    anchors.fill: parent
                    border.width: 1
                    border.color: "red"
                    color: Qt.rgba(1, 0, 0, 0.3)
                    visible: currentIndex===0
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked: currentIndex=0
                }
            }
        }

        Rectangle{
            width: 130
            height: 184
            color: Qt.rgba(222/250,222/250,222/250,1)

            Image {
                source: "qrc:/images/man2.png"
                Rectangle{
                    anchors.fill: parent
                    border.width: 1
                    border.color: "red"
                    color: Qt.rgba(1, 0, 0, 0.3)
                    visible: currentIndex===1
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked: currentIndex=1
                }
            }
        }

        Rectangle{
            width: 130
            height: 184
            color: Qt.rgba(222/250,222/250,222/250,1)

            Image {
                source: "qrc:/images/man3.png"
                Rectangle{
                    anchors.fill: parent
                    border.width: 1
                    border.color: "red"
                    color: Qt.rgba(1, 0, 0, 0.3)
                    visible: currentIndex===2
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked: currentIndex=2
                }
            }
        }
    }

    ButtonBase{
        text: "选择角色"
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 50
        onClicked: {
            console.log(text)
            bg.hide()
            selectMan(bg.currentIndex)
        }
    }

}
